#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
using namespace std;
void example_p338();
void example_p339();
void practice_10_4();
void practice_10_6();
void practice_10_9();
void elimDups(vector<int> &nums);
int main()
{
	//example_p338();
	//example_p339();
	//practice_10_4();
	//practice_10_6();
	practice_10_9();
	return 0;
}
void example_p338()
{
	vector<int> vec{1,2,4,5,6,4,5,4};
	int sum=accumulate(vec.cbegin(),vec.cend(),0);
	cout<<sum<<endl;
	vector<string> vs{"zbn","ctr","lmn","opq"};
	string sums=accumulate(vs.cbegin(),vs.cend(),string(""));
	cout<<sums<<endl;
}
void example_p339()
{
	vector<int> roster1{1,2,4,5};
	vector<int> roster2{3,1,2,4,5,6};
	auto result=equal(roster1.cbegin(),roster1.cend(),roster2.cbegin());
	cout<<result<<endl;
}
void practice_10_4()
{
	vector<double> v{1.8,3.4,5.6,2.7,4.8};
	auto sum=accumulate(v.cbegin(),v.cend(),0.0);
	cout<<sum<<" ";
}
void practice_10_6()
{
	vector<int> vec{1,2,4,5,6,4,5,4};
	fill_n(vec.begin(),vec.size(),0);
	for(auto c:vec)
	 	cout<<c<<" "; 
}
void elimDups(vector<int> &nums)
{
	sort(nums.begin(),nums.end());
	auto end_unique=unique(nums.begin(),nums.end());
	nums.erase(end_unique,nums.end());
}
void practice_10_9()
{
	vector<int> v1{1,4,5,1,1,6,7,6,6};
	elimDups(v1);
	for(auto c:v1)
		cout<<c<<" ";
}
